<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title><?php echo $title;?></title>
<link href="<?php echo base_url(); ?>assets/public/css/reset.css" media="screen" rel="stylesheet" type="text/css" />
<link href="<?php echo base_url(); ?>assets/public/css/style.css" media="screen" rel="stylesheet" type="text/css" />
<!--[if IE]>
<link href="css/ie.css" media="screen" rel="stylesheet" type="text/css">
<![endif]-->
<?php 
foreach($css_files as $file): ?>
	<link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
<?php endforeach; ?>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/public/js/jquery-1.4.4.min.js"></script>
<?php foreach($js_files as $file): ?>
<script type="text/javascript" src="<?php echo $file; ?>"></script>
<?php endforeach; ?>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/public/js/jquery-tipsy.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/public/js/jquery-custom.js"></script>
</head>
<body>
<div class="shadow"></div>
<!-- .shadow -->
<?php $this->load->view("common/header_view"); ?>
 <?php $this->load->view("common/sidebar_view",$sb);?>
<!-- BEGIN CONTENT -->
<div id="content">
    <div class="box-out">
    	<div class="box-in">
    		<div class="box-head"><h1><?php echo $content_title;?></h1></div>
                <div class="box-content" id="personnel_content">
                    <!--*********************Layout content********************************-->
                    <?php if(is_admin()|| (is_pm($pj_id))){ ?>
                    <input type="button" id="btnnew"  class="mysubmit"  value="Thêm công việc"/><br/><br/>
                    <script type="text/javascript">
                        $('#btnnew').click(function(){
                            window.location= <?php echo "'".base_url().'works/manager/'.$pj_id.'/'."'";?>+ '0/add';
                        });
                    </script>
                    <?php } ?>
                    <select style="height:300px;width:600px;font-size: 0.9em" multiple="multiple" id="boxWork">
                        <?php works_multi_level_form2($works); ?>
                    </select>
                    <?php //print_r($works) ?>
                    <script type="text/javascript">
                        $('#boxWork').change(function(){
                            var values = $('#boxWork').val();
                            var l = values.length;
                            var end = values[l-1];
                            $('#boxWork option:selected').each(function(index){
                                if(index!=(l-1)){
                                    $(this).removeAttr('selected');
                                }
                            });
                        });
                    </script>
                    <!--*********************End layout content****************************-->
                    <br/><br/>
                    <input type="button" id="btnsplit"  class="mysubmit"  value="Phân rã công việc"/>
                    <script type="text/javascript">
                        $('#btnsplit').click(function(){
                            var work_id = $('#boxWork').val();
                            if(work_id==null){
                                alert('Chọn công việc để phân rã');
                            }else {
                            window.location= <?php echo "'".base_url().'works/manager/'.$pj_id.'/'."'";?>+work_id + '/add';
                            }
                        });
                    </script>
                    <input type="button" id="btnedit"  class="mysubmit"  value="Sửa" style="margin-left: 20px;"/>
                    <script type="text/javascript">
                        $('#btnedit').click(function(){
                            var work_id = $('#boxWork').val();
                            if(work_id==null){
                                alert('Chọn công việc để phân rã');
                            }else {
                            window.location= <?php echo "'".base_url().'works/manager/'.$pj_id."'";?>+'/edit/'+work_id;
                            }
                         });
                    </script>
                    <input type="button" id="btndel"  class="mysubmit"  value="Xóa" style="margin-left: 20px;"/>
                    <script>
                        $('#btndel').click(function(){
                            var work_id = $('#boxWork').val();
                            if(work_id==null){
                                alert('Chọn công việc để phân rã');
                            }else {
                            var sure = confirm('Xóa công việc này và tất cả công việc con ?');
                            if(sure)
                               window.location= <?php echo "'".base_url().'works/delete/'."'";?>+work_id;
                            }
                         });
                    </script>
                </div>
        </div>
    </div>
</div>
<!--- END CONTENT --->

</body>
</html>
